#include <stdio.h>
#include <string.h>
#include "list.h"

static void show_char(const void *data);
static int char_cmp(const void *data, const void *key);

int main(int argc, char *argv[])
{
	// 存argv[1]字符串的每一个字符
	list_t *head = NULL;
	int i;
	char *del;

	if (argc < 2)
		return 1;

	listhead_init(&head, sizeof(char));

	for (i = 0; argv[1][i]; i++)	
		list_insert_tail(head, argv[1] + i);
	list_traval(head, show_char);
	printf("\n");

	list_destroy(&head);

	return 0;
}

static void show_char(const void *data)
{
	char *d = (char *)data;
	printf("%c", *d);
}

static int char_cmp(const void *data, const void *key)
{
	char *d = (char *)data;
	char *k = (char *)key;
	return *k - *d;
}



